<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>KFC</title>
	<style type="text/css">
		table { border-collapse:collapse; border:solid 1px black; }
        table th, table td { height:20px; border:solid 1px Black; padding: 10px; }
        td img { height: 100px; }
	</style>
</head>
<body>
	<div  style="float:right; width: 50%;">
		<form action="../sec/searchDish" method="post">
			<input type="hidden" value="${merchant.mId }" name="mid">
			<select name="dtype">
				<c:forEach items="${ dishTypes }" var="t">
					<option value="${ t.dishTypeNum }" ${ param.dtype eq t.dishTypeNum ? "selected=\"selected\"" : "" }>${ t.dishTypeName }</option>
				</c:forEach>
			</select>
			<input type="text" placeholder="输入菜名" name="dishName" value="${ param.keyword }" />
			<input type="submit" value="搜索"/>
		</form>
	</div>

	<a href="home">&lt;&lt; 返回首页</a>
	<h2>${ merchant.mName }</h2>
	<p>地址: ${ merchant.mAddr }</p>
	
	<table>
		<thead>
			<tr>
				<th>预览</th>
				<th>名称</th>
				<th>类型</th>
				<th>价格</th>
				<th>数量</th>
				<th></th>
			</tr>
		</thead>
		<tbody>
		
			<c:forEach items="${ dishes }" var="d">
				<tr>
					<td><img src="../local/${ d.dImage }"/></td>
					<td>${ d.dName }</td>
					<td>${ dishTypes.get(d.dType).dishTypeName }</td>
					<td>${ d.dPrice }</td>
					<td><input type="number"/></td>
					<td><a href="#">点餐!</a></td>
				</tr>
			</c:forEach>

		</tbody>
	</table>

</body>
</html>